﻿
namespace MoneyBook.Web.Models {
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.ComponentModel.DataAnnotations;
    using System.Data.Objects.DataClasses;
    using System.Linq;
    using System.ServiceModel.DomainServices.Hosting;
    using System.ServiceModel.DomainServices.Server;
    using MoneyBook.Web.Assets.Resources;


    // The MetadataTypeAttribute identifies AccountMetadata as the class
    // that carries additional metadata for the Account class.
    [MetadataTypeAttribute(typeof(Account.AccountMetadata))]
    public partial class Account {

        // This class allows you to attach custom attributes to properties
        // of the Account class.
        //
        // For example, the following marks the Xyz property as a
        // required property and specifies the format for valid values:
        //    [Required]
        //    [RegularExpression("[A-Z][A-Za-z0-9]*")]
        //    [StringLength(32)]
        //    public string Xyz { get; set; }
        internal sealed class AccountMetadata {

            // Metadata classes are not meant to be instantiated.
            private AccountMetadata() {
            }

            public int AccountId { get; set; }

            public EntityCollection<AccountMember> AccountMembers { get; set; }

            [Display(Name = "AccountName", ResourceType = typeof(Strings))]
            [Required(ErrorMessageResourceName = "ValidationErrorRequiredField", ErrorMessageResourceType = typeof(Strings))]
            public string AccountName { get; set; }

            [Display(Name = "Description", ResourceType = typeof(Strings))]
            public string Description { get; set; }

            public EntityCollection<Member> Members { get; set; }

            public Member Owner { get; set; }

            public int OwnerId { get; set; }

            [Include]
            public EntityCollection<Category> Categories { get; set; }
        }
    }
}
